package com.yanqu.road.entity.activity.zhenhuan.config;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_zhenhuan_place", desc = "甄嬛传第二阶段地点表")
public class ZhenHuanPlaceConfig extends DataObject {
    @FieldTypeAnnotation(select = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "地点id", isIndex = true)
    private int id;
    @FieldTypeAnnotation(desc = "名称")
    private String name;
    @FieldTypeAnnotation(desc = "描述")
    private String desc;
    @FieldTypeAnnotation(desc = "进度")
    private int progress;
    @FieldTypeAnnotation(desc = "喜爱度奖励")
    private int loveReward;
    @FieldTypeAnnotation(desc = "权重")
    private int weight;
    @FieldTypeAnnotation(desc = "完成奖励")
    private String overReward;
    @FieldTypeAnnotation(desc = "普通随机文本")
    private String commonEvent;
    @FieldTypeAnnotation(desc = "满进度随机文本")
    private String specialEvent;
    @FieldTypeAnnotation(desc = "到达奖励")
    private String reachReward;

    private Property overRewardProperty = new Property();
    private List<List<Property>> reachRewardList = new ArrayList<>();

    public ZhenHuanPlaceConfig(ResultSet rs) throws SQLException {
        this.activityId = rs.getInt("activityId");
        this.id = rs.getInt("id");
        this.name = rs.getString("name");
        this.desc = rs.getString("desc");
        this.progress = rs.getInt("progress");
        this.loveReward = rs.getInt("loveReward");
        this.weight = rs.getInt("weight");
        this.overReward = rs.getString("overReward");
        this.commonEvent = rs.getString("commonEvent");
        this.specialEvent = rs.getString("specialEvent");
        this.reachReward = rs.getString("reachReward");

        this.overRewardProperty = PropertyHelper.parseStringToProperty(this.overReward);

        this.reachRewardList = PropertyHelper.parseNewStringToPropertyList(this.reachReward);
    }

    public int getActivityId() {
        return activityId;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    public int getProgress() {
        return progress;
    }

    public String getOverReward() {
        return overReward;
    }

    public String getCommonEvent() {
        return commonEvent;
    }

    public String getSpecialEvent() {
        return specialEvent;
    }

    public String getReachReward() {
        return reachReward;
    }

    public Property getOverRewardProperty() {
        return overRewardProperty;
    }

    public List<List<Property>> getReachRewardList() {
        return reachRewardList;
    }

    public int getLoveReward() {
        return loveReward;
    }

    public int getWeight() {
        return weight;
    }
}
